home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: "James E. Fuller" <jef@ix.netcom.com>
- Newsgroups: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
- Subject: Re: C coding problem
- Date: 3 Apr 1996 19:14:53 -0600
- Organization: Fuller & Stone
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4jv7qd$da7@solutions.solon.com>
- References: <4ianbf$h86@solutions.solon.com> <4iemcl$a05@solutions.solon.com> <4io1io$no4@solutions.solon.com> <4j41ru$nq4@solutions.solon.com> <4jttlq$3p1@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Mailer: Mozilla 3.0B2 (WinNT; I)
-
- Niall Smart wrote:
- >
- > Michael Smith <msmith@mpx.com.au> wrote:
- >
- > >Konrad Schwarz wrote:
- > >>
- > >> I recently wrote a loop that went like this:
- > >>
- > >> while (p < end_p)
- > >> ++*p++;
- > >>
- >
- > >This is largely a matter of taste
- >
- > I would argue that it is far more than that.
- >
- > >, but personally I don't like that
- > >construct. A programmer less skilled than you might easily misunderstand
- > >that and introduce an error. I would prefer:
- >
- > >for ( ; p<end_p; p++)
- > > ++(*p);
- >
- > or either of:
- >
- > while (p < end_p)
- > {
- > (*p)++;
- > p++;
- > }
- >
- > while (p++ < end_p)
- > {
- > (*p)++;
- > }
- >
- > Zero chance for ambiguity in the last three versions.
- >
- > Niall
-
- I don't think that last one does the same stuff as the others.
-
- Unambiguously or otherwise.
-